package org.demo.controller;

import org.demo.common.Result;
import org.demo.entity.HousesDto;
import org.demo.entity.HousesItem;
import org.demo.entity.Housewear;
import org.demo.service.IHousesItemService;
import org.demo.service.IHousewearService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

//房屋明细表
@RestController
@RequestMapping("/housesItem")
public class HousesItemConteoller {
    @Autowired
    private IHousesItemService housesItemService;
    @PostMapping("/add")
    public Result add(@RequestBody HousesItem housesItem){
        housesItemService.add(housesItem);
        return Result.success();
    }
    @PostMapping("/selectItem")
    public Result<HousesDto> selectItem(@RequestBody (required = false) HousesItem housesItem){
        HousesDto pb= housesItemService.selectItem(housesItem);
        return Result.success(pb);
    }
    @PutMapping("/update")
    public Result update(@RequestBody HousesItem housesItem){
        housesItemService.update(housesItem);
        return Result.success();
    }
    @DeleteMapping("/delete")
    public  Result delete(String id){
        housesItemService.delete(id);
        return Result.success();
    }

}
